import request from "@/api";
import type {
    rpDirDataType, rpResultParams, rpResultData, rpDataItemTableData,
    rpDataItemTableDataParams,
} from "@/api/reportCom/type";
import type {resData} from "@/api/goloalType";
import {ListByReport, ListByReportParams} from "@/api/reportCom/type";

//获取报告目录
export const getRpAndDirList = () => request.get<any, resData<rpDirDataType[]>>('/reportApi/report/report/report/and/dir')

//获取报告时间
export const getRpTime = (id: string | number) => request.get<any, resData<string[]>>(`/reportApi/report/report/get/report/time/${id}`)

//根据时间获取报告结果
export const getRpResult = (params: rpResultParams) => request.get<any, resData<rpResultData>>(`/reportApi/report/report/get/report/result`, {
    params: params
})

//获取统计项对应的明细数据
export const getDataItemTableData = (params: rpDataItemTableDataParams) => request.get<any, resData<rpDataItemTableData>>
(`/reportApi/report/report/get_data_item_table_data`, {
    params: params
})

//获取统计项对应的明细数据表头
export const getDataItemTableHeaders = (params: {dataId:string}) => request.get<any, resData<string[]>>
(`/reportApi/report/report/get_data_item_table_headers`, {
    params: params
})

//保存自输入文本
export const saveCustomerText = (params: {instanceStructId:string|number,text:string}) => request.post<any, resData<string>>
(`/reportApi/report/report_instance/save/customer_text`, params)
